﻿using System;
using FU.Capstones.IMS.Web.Common.InventoryServiceProxy.DataContracts;
using FU.Capstones.IMS.Web.Common.InventoryServiceProxy.EventArgs;

namespace FU.Capstones.IMS.Web.Silverlight.Models
{
    public class ContactModel : ModelBase
    {
        public event EventHandler<SingleFeedbackCompletedEventArgs<int>> InsertContactCompleted;

        public ContactModel()
        {
            client.InsertContactCompleted += DoAddContactCompleted;
        }

        #region DoAddContactCompleted

        private void DoAddContactCompleted(object sender, SingleFeedbackCompletedEventArgs<int> e)
        {
            if (InsertContactCompleted != null)
            {
                InsertContactCompleted(sender, e);
            }
        }

        public void AddNewContactAsync(Contact contact)
        {
            client.InsertContactAsync(contact);
        }

        #endregion

    }
}
